<?php
	require_once('../class/SuKienDAO.php');
	require_once('../class/GianHangDAO.php');	
	require_once('../class/NguoiDungDAO.php');
	
	//kiểm tra quyền truy xuất
	if (!isset($_REQUEST['maGH']) || !isset($_REQUEST['NgayBD']) || 
		!isset($_REQUEST['NgayKT']) ||$_SESSION['Authentication'] != 2 || 
	   $_SESSION['IsLogin'] == 0 )
	{
		header('Location:../ds_gian_hang.php');
		return;
	}
	else 
	{
		$maGH = $_REQUEST['maGH'];
		$nguoiDungDto = NguoiDungDAO::LayThongTinNguoiDungTheoMa($_SESSION['IdUser']);
		if ($maGH != $nguoiDungDto->MaGianHang )
		{
			header('Location:../ds_gian_hang.php');
			return;
		}
		else
		{
			$dsSuKien = SuKienDAO::LayDanhSachSuKienTrongKhoangThoiGian($maGH,
									$_REQUEST['NgayBD'],$_REQUEST['NgayKT']);
		}
	}

?>